package com.senven.books.modules.system.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.senven.books.modules.system.user.entity.SysUser;
import com.senven.books.modules.system.user.mapper.SysUserMapper;
import com.senven.books.modules.system.user.service.SysUserService;
import com.senven.books.mybatis.dbencrypt.BaseServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author : longshengyi
 * @description :
 * @createDate : 2024/7/21 12:07
 */
@Service
public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper,SysUser> implements SysUserService {

    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser getSysUserByUsername(String account) {
        if (StringUtils.isNotEmpty(account)) {
            LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
            queryWrapper.eq(SysUser::getAccount, account);
            queryWrapper.eq(SysUser::getDeleted,"0");
            return this.sysUserMapper.selectOne(queryWrapper);
        }
        return null;
    }
}
